%macro get_f5498;

	
	proc printto log = "&logdir/get_f5498.txt" new;
	run;
	

		/****************************
		*	Get the tins 			*
		*	into 'tinlist'			*
		****************************/
		%make_tinlist;

		/****************************************
		*										*
		*			Start PROC SQL				*
		*										*
		****************************************/
		proc sql noprint;
		[connection details redacted]
			create table rlib.f5498 as
			select * from connection to iq 
			(
			select
				a.[redacted] as person_id,
				sum(
					coalesce(a.[redacted],0)
					+ coalesce(a.[redacted],0)
				) as contrib_ira
			from [redacted] as a
				inner join #tinlist as b
					on(a.[redacted] = b.person_id)
			where a.tax_yr = &base_yr
			group by a.tin
			);
			disconnect from iq;
			quit;



		

	proc printto;
	run;
%mend;
